const express = require('express')
const router = express.Router()
const fs = require('fs')

router.get('/', (req, res) => {
  fs.readFile(__dirname + '/../data/1.txt', 'utf-8', (err, data) => {
    if (err) res.send(err)
    // res.send(`home-${req.params.id}`)
    // let buffer = new Buffer(data)
    // console.log(data);
    res.send(data)
  })
})

router.post('/download', (req, res) => {
  fs.readFile(__dirname + '/../data/1.xlsx', 'utf-8', (err, data) => {
    if (err) res.send(err)
    res.send(data)
  })
})

module.exports = router
